package com.net.xpay.common.domain.admin.rbac;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.net.common.annotation.NonDomain;
import com.net.common.domain.CommonDomain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 2019/5/31 18:00

 * 运营平台管理员
 */
@Getter
@Setter
@NoArgsConstructor
public class AdminUser extends CommonDomain {

    @ApiModelProperty("用户名")
    private String username;

    @ApiModelProperty("头像")
    private String avatar;

    @ApiModelProperty("邮箱")
    private String email;

    @ApiModelProperty("手机号")
    private String mobile;

    @ApiModelProperty("账号是否激活")
    private Boolean enabled;

    @ApiModelProperty("密码")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    @ApiModelProperty("登录出错次数，所有登录途径（达到10次冻结账号，只能有超级管理员解冻账号）")
    private Long errorLoginCount;

    @ApiModelProperty(notes = "上次登录时间", example = "2018-12-17 11:53:18")
    private LocalDateTime lastLoginTime;

    @ApiModelProperty(notes = "最后一次登陆ip", example = "192.0.0.3")
    private String lastLoginIp;

    @ApiModelProperty("密码最后更新时间")
    private LocalDateTime lastPasswordResetTime;

    //是否是超级管理员
    @NonDomain
    private Boolean superAdmin;

    @NonDomain
    private List<Permission> permissions = new ArrayList<>();

    //按钮ops 控制页面上的按钮显示用
    @NonDomain
    private List<String> roles = new ArrayList<>();
}
